function beforeLoad() {
	//document.all.oframe.showdialog(1);
}
function UnLoad() {
	dsoFrame.Close();
}
// 打开文档
function openDoc() {
	closeDoc();
	dsoFrame.showdialog(1);
}
// 创建文档
function newDoc() {
	closeDoc();
	dsoFrame.showdialog(0);
}
// 新建word
function openWord() {
	try {
		closeDoc();
		dsoFrame.CreateNew("Word.Document");
		docType = 0;
	} catch (E) {
		alert(E.message);
	}
}
// 新建Excel 
function openExcel() {
	try{
		closeDoc();
		dsoFrame.CreateNew("Excel.Sheet");
		docType = 1;
	} catch (E) {
		alert(E.message);
	}
}
// 新建PPT
function openPPT() {
	try {
		closeDoc();
		dsoFrame.CreateNew("PowerPoint.Show");
		docType = 2;
	} catch (E) {
		alert(E.message);
	}
}
// 新建visio
function openVisio() {
	try{
		closeDoc();
		dsoFrame.CreateNew("Visio.Drawing");
	} catch (E) {
		alert(E.message);
	}
}

// 关闭文档
function closeDoc() {
	dsoFrame.Close();
}
// 打印设置
function printDes() {
	dsoFrame.showdialog(5);
}
// 打印
function print() {
	dsoFrame.showdialog(4);
}
//  打印预览
function prePrint() {
	dsoFrame.PrintPreview();
}
// 文件属性
function attribute() {
	dsoFrame.showdialog(6);
}
// 退出打印预览
function prePrintExit() {
	dsoFrame.PrintPreviewExit();
}
// 保存文档到本地
function saveCopyDoc() {
	dsoFrame.showdialog(3);
}
// 打开服务器文件
function openServerFile() {
	dsoFrame.open(MAP_C_SERVER_URL + '//' + "a.docx", true, "Word.Document");
}
// 将文件保存到服务器上
function saveFileToServer() {
	// 先保存到本地 ，然后在通过本地上传到服务器上
	// var WshShell = new ActiveXObject("WScript.Shell");
	// strDesktop = WshShell.SpecialFolders("Desktop");
	//dsoFrame.save("c://temp//temp.docx", true);
	//fileForm.submit();
//	dsoFrame.HttpInit();
//	dsoFrame.HttpAddPostCurrFile("FileData", "c://dsoframer.ocx");
//	dsoFrame.HttpPost("http://localhost:8089//test_01//dsoframer/testOfficeOnline.jsp"); 
	//document.getElementById("test").SaveToURL("http://localhost:8089//test_01//fileUpload");
//	dsoFrame.SaveToURL(document.forms[0].action,"worddoc","","c://dsoframer.ocx",0);
//	alert(document.forms[0].action)
//	alert(document.all("test").SaveToURL)
	// 	请保存文件
	
	var tempFile = "";
	if (docType == 0) {
		tempFile = "temp.doc";
	} else if (docType == 1) {
		tempFile = "temp.xls";
	} else if (docType == 2) {
		tempFile = "temp.ppt";
	}
	
	dsoFrame.save(tempFile,true);
	dsoFrame.HttpInit();
//  	dsoFrame.HttpAddPostString("RecordID", "无");
// 	dsoFrame.HttpAddPostString("UserID", "无");
	dsoFrame.HttpAddPostCurrFile("FileData", tempFile);
// 	dsoFrame.HttpAddPostCurrFile("FileData", "temp.xlsx");
 	
 	dsoFrame.HttpPost(MAP_C_SERVER_URL+"//OfficeUpload");
	//document.getElementById('test').SaveToURL(document.forms[0].action,"fileForm","","c://dsoframer.ocx",document.forms[0].action);
}


function isSave() {
	alert(dsoFrame.IsDirty);
}

function aa() {
	// ie6
	var WshShell = new ActiveXObject("WScript.Shell");
	keyValue = WshShell
			.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Cache\\Paths\\Directory");
	alert(keyValue);
}